#include"DictServer.hpp"
#include"Dict.hpp"
void Useage_Server(char* ch[])
{
    std::cout << "Useage: " << ch[0] << " port" << std::endl; 
}

int main(int argc,char* argv[])
{
    if(argc != 2)
    {
        Useage_Server(argv);
        exit(1);
    }

    std::string port = argv[1];
    uint16_t _port = std::stoi(port);
    Dict _dict("./dict.txt");
    std::unique_ptr<DictServer> _uptr = std::make_unique<DictServer>(_port,
        [&_dict](const std::string& word,const std::string Clientip,const std::string Clientport)->std::string{
            return _dict.Translate(word);
    });

    _uptr->Init();
    _uptr->Start();
    _uptr->Stop();


    return 0;
}